<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="IndexAdmin.xhtml">

	<ui:define name="conteudo">
		<f:loadBundle basename="br.ucb.jogo.recursos.messages" var="msg" />
		<h:form>
			<p:growl id="growl" sticky="true" showDetail="true" />
				<p:tab id="pessoal" title="pessoal">
					<p:panel header="#{msg.DADOS_PESSOAIS}">
						<h:messages errorClass="error" />
						<h:panelGrid columns="3" columnClasses="label, value"
							styleClass="grid">
							<h:outputText value="#{msg.NOME}" disabled = "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:inputText id="nome" required="true" label="Nome" value="#{usuarioManagedBean.user.nome}" disabled = "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="0"/> 
							</p:inputText>
							<h:message for="nome" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							<h:outputText value="#{msg.EMAIL}" disabled= "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:inputText  id="email" required="true" label="Email" value="#{usuarioManagedBean.user.email}" disabled= "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="0"/> 
							</p:inputText>
							<h:message for="email" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							<h:outputText value="#{msg.LOGIN} " disabled= "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:inputText id="login" required="true" label="Login" value="#{usuarioManagedBean.user.login}" disabled= "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="0"/> 
							</p:inputText>
							<h:message for="login" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							<h:outputText value="#{msg.SENHA}" disabled= "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:password id="senha" required="true" value="#{usuarioManagedBean.user.senha}" feedback="true" promptLabel="Digite uma senha segura" goodLabel="Boa" weakLabel="Razoável" strongLabel="Excelente" disabled= "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="6"/> 
							</p:password>
							<h:message for="senha" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							
							<h:outputLabel value="#{msg.TIPO_DE_ACESSO}" for="tipo"  rendered="#{loginManagedBean.isUserInRole('admin')}"/>
							<h:selectOneRadio id="tipo" value="#{usuarioManagedBean.user.tipo}" label="tipo" required="true" rendered="#{loginManagedBean.isUserInRole('admin')}">
								<f:selectItem itemValue="1" itemLabel="#{msg.USUARIO}"  />
								<f:selectItem itemValue="2" itemLabel="#{msg.ADMIN}" />
							</h:selectOneRadio>	
							<h:message for="tipo" showSummary="true" showDetail="false" errorStyle="color:red"/>

							<h:outputText value="#{msg.CIDADE}" disabled= "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:inputText id="cidade" required="false" label="cidade" value="#{usuarioManagedBean.user.cidade}" disabled= "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="0"/> 
							</p:inputText>
							<h:message for="cidade" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							<h:outputText value="#{msg.ESTADO} " disabled= "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:inputText id="estado" required="false" label="estado" value="#{usuarioManagedBean.user.estado}" disabled= "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="0"/> 
							</p:inputText>
							<h:message for="estado" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							<h:outputText value="#{msg.BAIRRO}" disabled= "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:inputText id="bairro" required="false" label="bairro" value="#{usuarioManagedBean.user.bairro}" disabled= "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="0"/> 
							</p:inputText>
							<h:message for="bairro" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							
							<h:outputText value="#{msg.RUA}" disabled= "#{loginManagedBean.isUserInRole('admin')}"/>
							<p:inputText id="rua" required="false" label="rua" value="#{usuarioManagedBean.user.rua}" disabled= "#{loginManagedBean.isUserInRole('admin')}">
								<f:validateLength  minimum="0"/> 
							</p:inputText>
							<h:message for="rua" showSummary="true" showDetail="false" errorStyle="color:red"/>
							
							<p:commandButton value="#{msg.ENVIAR}" update="growl" action="#{usuarioManagedBean.save}" ajax="false"/>

						</h:panelGrid>

					</p:panel>
				</p:tab>
 

		</h:form>
	</ui:define>

</ui:composition>
</html>